<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  * {
    margin: 0;
    padding: 0;
  }

  .drag-up {
    -webkit-animation: dragup ease 0.2s 1;
    animation: dragup ease 0.2s 1;
    -webkit-animation-fill-mode: forwards;
    animation-fill-mode: forwards;
    background-color: red;
  }

  .drag-down {
    -webkit-animation: dragdown ease 0.2s 1;
    animation: dragdown ease 0.2s 1;
    -webkit-animation-fill-mode: forwards;
    animation-fill-mode: forwards;
    background-color: green;
  }

  @-webkit-keyframes dragup {
    from {
      margin-top: 10px;
    }

    to {
      margin-top: 60px;
    }
  }

  @keyframes dragup {
    from {
      margin-top: 10px;
    }

    to {
      margin-top: 60px;
    }
  }

  @-webkit-keyframes dragdown {
    from {
      margin-bottom: 10px;
      margin-top: 60px;
    }

    to {
      margin-bottom: 60px;
      margin-top: 10px;
    }
  }

  @keyframes dragdown {
    from {
      margin-bottom: 10px;
      margin-top: 60px;
    }

    to {
      margin-bottom: 60px;
      margin-top: 10px;
    }
  }
</style>

<body>
  <div id="root"></div>
</body>

</html>